<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>牛只管理</title>
		<link href="css/new_file.css" rel="stylesheet" type="text/css">
		<link href="css/mui.min.css" rel="stylesheet" type="text/css">

		<script src="js/mui.min.js"></script>

		<script charset="UTF-8" src="js/config.js"></script>
		<script charset="UTF-8" src="js/testActivityName.js"></script>
		<script charset="UTF-8" src="js/core.js"></script>
		<script charset="UTF-8" src="js/cipher-core.js"></script>
		<script charset="UTF-8" src="js/tripledes.js"></script>
		<script charset="UTF-8" src="js/mode-ecb.js"></script>
		<script src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="js/zepto.min.js"></script>
		<script type="text/javascript" src="js/spin.min.js"></script>

		<script src="js/jquery.qrcode.min.js"></script>
		<script src="js/qrcode.js"></script>
		<script src="js/jquery.qrcode.js"></script>

		<script src="js/mui.picker.js"></script>
		<script src="js/mui.poppicker.js"></script>
		<script src="js/city.data.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
	</head>
    

	<style>
		.mui-bar{
			     padding-right: 0px; 
			     padding-left:0px;
                 
		}
    
	</style>
    
	<body>

		
		<header id="header" class="mui-bar mui-bar-transparent" style="width: 100%;">
				<div class="head-zhjf">
					<img src="images/fanhui@3x.png" class="ryjk-tx" onclick="fanhuizhuan()">
					<div>批量找牛</div>
				</div>
			
				<div class="search-div">
					<div class="g-bd2">
						<div class="search-l-div">
							<div class="seach-l-a">
								<img class="sousuo-acx" src="images/sousuo-btn@3x.png">
								<input id="CattleSeachDatacowLost" class="xtsz-search-btn" type="text" placeholder="请输入搜索内容" onfocus="if(value==defaultValue){value='';this.style.color='#393e46'}" onblur="if(!value){value=defaultValue;this.style.color='#cdcdcd'}">
			
							</div>
						</div>
						<div class="seach-r-div" onclick="cowLostSeach()">
							<img class="cx-div" src="images/sousuo-a-btn@3x.png" />
						</div>
					</div>
				</div>
		</header>
		<div style="margin-top: 90px;" class="clear"></div>
		<div id="CowshedID" >
			<div style="width: 100%;height: 100%;text-align: center;margin-top: 45%;">
				<img src="images/nodata.png" style="width: 200px;height: 140px;"/>
			</div>
		</div>
		<div id="hddb" style="position: fixed;right: -63px;bottom: 30px;border-radius: 25px;width: 50px;height: 50px;text-align: center;">
			<img src="img/hddb.png" style="width: 32px;height: 32px;    margin-top: 9px;" onclick="goTop()">
		</div>
		<script>
            var cowLostData = JSON.parse(localStorage.getItem('cowLostData'));
			var CowshedID = document.getElementById('CowshedID');
			//绘制单个div
			function setDiv(item, i) {
				var div = '<div class="plzn-div" id="' + i + '" onclick="CowshedBut(this.id)"><div class="plzn-div-left"><div class="plzn-div-left-a"><p class="nsh" >' +
					item.house +
					'</p><p class="nsrq" >' +
					item.date +
					'</p></div></div><div class="plzn-div-right"><div style="float: left;"><p class="wgnz">' +
					item.number +
					'</p><p>数量</p></div><img class="zn-img" src="images/jiantou@3x.png" /></div><div class="clear"></div></div>'
				return div
			}

			function getnoApplicationData() {
				var html = ''
				for(var i = 0; i < cowLostData.length; i++) {
					html += setDiv(cowLostData[i], i)
				}
				CowshedID.innerHTML = html
			}
			if(cowLostData.length != 0){
				window.onload = getnoApplicationData()
			}
			

			function CowshedBut(id) {
				
				var houseID = cowLostData[id]["houseID"];
				localStorage.setItem('alarmID', JSON.stringify(houseID));
				var keys = JSON.parse(localStorage.getItem('key'));
				var map = {};
				map.key = keys;
				map.houseID = houseID;
				map.phoneType = "android";
				map.language = "zh";
				var jsonStr = JSON.stringify(map);
				$.ajax({
					type: "POST",
					url: url_prefix + "alarm",
					dataType: 'JSON',
					timeout: 10000,
					data: {
						'request': encryptByDES(jsonStr)
					},
					success: function(data) {
						var str1 = decryptByDESModeEBC(data["result"]); //解密
						var params = str1.replace(/\+/g, " "); //去掉字符串里的+号
						var str2 = UTFTranslate.ReChange(chineseFromUtf8Url(params)); //转utf8
						var datas = JSON.stringify(str2); //转JSON字符串
						var aa = datas.replace(/\\n/g, " "); //去掉换行
						var objs = eval('(' + aa + ')');
						var bb = eval('(' + objs + ')');
						if(bb.head.status == 1) {
							console.log(bb.data);
							localStorage.setItem('alarmData', JSON.stringify(bb.data));
							window.location = "5.预警管理.html";
						} else {
							mui.alert(bb.head.info);
						}
					}
				});

			}
			function fanhuizhuan(){
				window.location = "功能列表.html";
			}
			function goTop(){
						    //速度
						    var speed = 100;
						    //开启定时器
						    
						    var timer = setInterval(function(){
						        //获取滚动条的高度
						        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
						        //设置滚动的高度
						        document.documentElement.scrollTop = document.body.scrollTop = (scrollTop - speed);
						        //清除定时器
						        speed += 30;
						        if(scrollTop <= 0){
						            clearInterval(timer);
						        }
						    },30)
						}
						
			function showLogin(){  
						    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
						    if (scrollTop > 0) {
						    	$("#hddb").css("right","-3px");
						    } else{
						    	$("#hddb").css("right","-63px");
						    } 
						    //每秒执行一次,showTime()  
						    setTimeout("showLogin()",500);  
						}
						showLogin()
		</script>
	</body>

</html>
